package com.karolak.stock.indicator;

import com.karolak.stock.data.DataManager;

public class SumInd extends Indicator {

	private Indicator input1;

	public SumInd(DataManager dataManager, Indicator input0, Indicator input1) {
		super(dataManager, 0, input0);
		this.input1 = input1;
		setName(String.format("%s%s%s", super.getName(), getInput().getName(), getInput1().getName()));
	}

	public SumInd(String name, DataManager dataManager, Indicator input0, Indicator input1) {
		super(dataManager, 0, input0);
		this.input1 = input1;
		setName(name);
	}

	public double execute(double x) {
		double v0 = getDataManager().getLast(getInput().getName());
		double v1 = getDataManager().getLast(getInput1().getName());
		double sum = v0 + v1;
		return sum;
	}

	public Indicator getInput1() {
		return input1;
	}
}
